package com.zz.parkingsystem.controller.admin;

import com.zz.parkingsystem.entity.Section;
import com.zz.parkingsystem.service.PCSecService;
import com.zz.parkingsystem.util.Result;
import com.zz.parkingsystem.util.ResultGenerator;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@Api(tags = "查询所有路段")
@RequestMapping("admin/sec")
public class AdminSecController {
    @Resource
    private PCSecService pcSecService;

    @GetMapping("")
    public Result getSec(){
        List<Section> allsec = pcSecService.getAllsec();
        return ResultGenerator.genSuccessResult(allsec);
    }
    @PostMapping("")
    public Result addSec(@RequestBody Section  section){
        int i = pcSecService.insertSelective(section);
        return ResultGenerator.genSuccessResult("添加成功");
    }
}
